package com.example.yskjproject.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

public class RechargeRecordListModel implements Parcelable {
    private List<RechargeRecordModel> list;
    private int total;

    // 构造函数
    public RechargeRecordListModel(List<RechargeRecordModel> list, int total) {
        this.list = list;
        this.total = total;
    }

    // Parcelable 构造函数
    protected RechargeRecordListModel(Parcel in) {
        total = in.readInt();
        list = new ArrayList<>();
        in.readList(list, RechargeRecordModel.class.getClassLoader());
    }

    // writeToParcel 方法
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(total);
        dest.writeList(list);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<RechargeRecordListModel> CREATOR = new Creator<RechargeRecordListModel>() {
        @Override
        public RechargeRecordListModel createFromParcel(Parcel in) {
            return new RechargeRecordListModel(in);
        }

        @Override
        public RechargeRecordListModel[] newArray(int size) {
            return new RechargeRecordListModel[size];
        }
    };

    // Getter 和 Setter 方法
    public List<RechargeRecordModel> getList() { return list; }
    public void setList(List<RechargeRecordModel> list) { this.list = list; }

    public int getTotal() { return total; }
    public void setTotal(int total) { this.total = total; }
}
